package com.ccit.springbootlaw.pojo;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Objects;

@Entity
@Table(name = "case_law_relationship") // 显式指定表名
// 案件法律关系表
// id (主键)
// case_id (案例ID)
// law_id (法律ID)
// created_at (创建时间)
// updated_at (更新时间)
public class CaseLawRelationship {
    private long id;
    private int caseId;
    private int lawId;
    private Timestamp created_at;
    private Timestamp updated_at;

    @Id
    @Column(name = "id")
    // id (主键)
    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    @Basic
    @Column(name = "case_id")
    // case_id (案例ID)
    public int getCaseId() {
        return caseId;
    }

    public void setCaseId(int caseId) {
        this.caseId = caseId;
    }

    @Basic
    @Column(name = "law_id")
    // law_id (法律ID)
    public int getLawId() {
        return lawId;
    }

    public void setLawId(int lawId) {
        this.lawId = lawId;
    }

    @Basic
    @Column(name = "created_at")
    // created_at (创建时间)
    public Timestamp getCreatedAt() {
        return created_at;
    }

    public void setCreatedAt(Timestamp createdAt) {
        this.created_at = createdAt;
    }

    @Basic
    @Column(name = "updated_at")
    // updated_at (更新时间)
    public Timestamp getUpdatedAt() {
        return updated_at;
    }

    public void setUpdatedAt(Timestamp updatedAt) {
        this.updated_at = updatedAt;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        CaseLawRelationship that = (CaseLawRelationship) o;
        return id == that.id && caseId == that.caseId && lawId == that.lawId && Objects.equals(created_at, that.created_at) && Objects.equals(updated_at, that.updated_at);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, caseId, lawId, created_at, updated_at);
    }
}